import React from "react";
import VoteMain from "./VoteMain";
import VoteFooter from "./VoteFooter";
import { connect } from 'react-redux'
function Vote(props) {
    let { supNum, oppNum } = props
    return <div className="vote-box">
        <div className="header" style={{
            display: 'flex'
        }}>
            <h2 className="title">React是很棒的前端框架</h2>
            <span className="num" style={{
                display: 'block',
                lineHeight: '72px',
                marginLeft: '50px'
            }}>{supNum + oppNum}</span>
        </div>
        <VoteMain />
        <VoteFooter />
    </div>
}
export default connect(state => state.vote)(Vote)
/* 
connect(mapStateToProps,mapDispatchToProps)(我们要渲染的组件)
    1. mapStateToProps: 可以获取到redux中的公共状态，把需要的信息作为属性，传递组件即可
        connect(state=>{
            //state:存储redux容器中，所有模块的公共状态信息
            //返回对象中的信息，就是要作为属性，传递给组件的信息
            return {
                supNum:state.vote.supNum,
                info:state.personal.info
            }
        })(Vote)
*/